package com.ruge.kafka.config;

import com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;

/**
 * @author ruge.wu
 * @since 2022/1/6 14:40
 */
@Configuration
public class ExecutorConfig {
    @Bean
    public ScheduledExecutorService scheduledExecutorService() {
        ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("kafka-thread-pool").build();
        return new ScheduledThreadPoolExecutor(16, threadFactory);
    }
}
